/*
 * Copyright 2025 author or author.
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.jcwang.commons.tools.util.net.client;

import org.springframework.http.HttpHeaders;

/**
 * 客户端请求获取 header 提供者
 *
 * @author 王金城
 **/
public interface RequestHeaderProvider {

    /**
     * 获取 header 值
     *
     * @param name header name
     * @return {@code java.lang.String}
     * @author 王金城
     */
    default String getHeader(String name) {
        return null;
    }

    /**
     * 获取 spring 的 header 对象
     *
     * @return {@code org.springframework.http.HttpHeaders}
     * @author 王金城
     */
    default HttpHeaders getHeaders() {
        return null;
    }

    /**
     * Returns the Internet Protocol (IP) address of the client or last proxy that sent the request. For HTTP servlets,
     * same as the value of the CGI variable <code>REMOTE_ADDR</code>.
     *
     * @return a <code>String</code> containing the IP address of the client that sent the request
     */
    default String getRemoteAddr() {
        return "";
    }
}
